package edu.sctu.practice.class02.yangyuran.test09;

import java.util.Scanner;

/**
 * Created by Administrator on 2015/10/12.
 */
public class User {
    public String ID;
    public String password;
    public String email;

    public User() {
        this.ID = ID;
        this.password = password;
        this.email = email;
    }

    public void Input() {
        System.out.println("请输入用户名：");
        Scanner scan = new Scanner(System.in);
        this.ID = scan.nextLine();
        if (ID.length() == 0) {
            System.out.println("用户名不能为空！请重新输入：");
            Scanner rescan = new Scanner(System.in);
            this.ID = rescan.nextLine();
        } else {
            System.out.println("用户名为：" + ID);
        }

        System.out.println("请输入密码：");
        Scanner sca = new Scanner(System.in);
        this.password = scan.nextLine();
        if (password.length() == 0) {
            System.out.println("密码不能为空！请重新输入：");
            Scanner resca = new Scanner(System.in);
            this.ID = resca.nextLine();
        } else {
            System.out.println("密码为：" + password);
        }

        System.out.println("请输入邮箱地址：");
        Scanner sc = new Scanner(System.in);
        this.email = scan.nextLine();
        if (email.length() == 0) {
            System.out.println("邮箱地址为：" + ID + "@gameschool.com");
        } else {
            System.out.println("邮箱地址为：" + email);
        }
    }

    public static void main(String[] args) {
        User user = new User();
        user.Input();//缺陷：只能对输入实现判定一次
    }
}
